class Solution(object):
    def isValidBST(self, root):
        """
        :type root: TreeNode
        :rtype: bool
        """
        #中序遍历单调递增
        def DFS(root, path):
            if root is None:
                return
            DFS(root.left, path)
            path.append(root.val)
            DFS(root.right, path)
        path = []
        DFS(root, path)
        for i in range(len(path) - 1):
            if path[i] >= path[i + 1]:
                return False
        return True
